From: Keir Fraser Date: Thu, 20 Nov 2008 14:15:50 +0000 (+0000) Subject: x86, hpet: Fix initialisation of secondary timers. X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~14043^2~11 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https://%22%22/%22http:/www.example.com/cgi/%22https:/%22%22?a=commitdiff_plain;h=9e70091fd71e108c5cb3cf89fa677030b088a0a8;p=xen.git x86, hpet: Fix initialisation of secondary timers. Each channel may have different settings, and in the original implementation, other Tn configuration will accidently overwrite T0 configuration. Signed-off-by: Guanqun Lu --- diff --git a/xen/arch/x86/hpet.c b/xen/arch/x86/hpet.c index e72e8f94e4..d5e84f4ccd 100644 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -276,9 +276,9 @@ u64 hpet_setup(void) set_fixmap_nocache(FIX_HPET_BASE, hpet_address); hpet_id = hpet_read32(HPET_ID); - if ( hpet_id == 0 ) + if ( (hpet_id & HPET_ID_REV) == 0 ) { - printk("BAD HPET vendor id.\n"); + printk("BAD HPET revision id.\n"); return 0; } @@ -296,9 +296,9 @@ u64 hpet_setup(void) for ( i = 0; i <= ((hpet_id >> 8) & 31); i++ ) { - cfg = hpet_read32(HPET_T0_CFG + i*0x20); + cfg = hpet_read32(HPET_Tn_CFG(i)); cfg &= ~HPET_TN_ENABLE; - hpet_write32(cfg & ~HPET_TN_ENABLE, HPET_T0_CFG); + hpet_write32(cfg, HPET_Tn_CFG(i)); } cfg = hpet_read32(HPET_CFG); diff --git a/xen/include/asm-x86/hpet.h b/xen/include/asm-x86/hpet.h index b63f56805d..82c08bc3c5 100644 --- a/xen/include/asm-x86/hpet.h +++ b/xen/include/asm-x86/hpet.h @@ -24,6 +24,10 @@ #define HPET_T2_CMP 0x148 #define HPET_T2_ROUTE 0x150 +#define HPET_Tn_CFG(n) (HPET_T0_CFG + n * 0x20) +#define HPET_Tn_CMP(n) (HPET_T0_CMP + n * 0x20) +#define HPET_Tn_ROUTE(n) (HPET_T0_ROUTE + n * 0x20) + #define HPET_ID_VENDOR 0xffff0000 #define HPET_ID_LEGSUP 0x00008000 #define HPET_ID_NUMBER 0x00001f00